<template>
  <div class="app-wrapper">
    <Navbar />
    <a-empty style="margin-top: 80px" description="暂无权限" />
  </div>
</template>
<script>
import Navbar from "@/layout/components/navbar/empty";
import { mapGetters } from "vuex";
export default {
  components: {
    Navbar
  },
  computed: {
    ...mapGetters(["permissions_menu"]),
    permissionsMenu() {
      return this.permissions_menu;
    }
  },
  watch: {
    permissionsMenu: {
      handler(newVal) {
        if (newVal && newVal.length > 0) {
          this.$router.push("/");
        }
      }
    },
    immediate: true
  },
  created() {
    this.checkStatus();
  },
  methods: {
    checkStatus() {
      this.$store.dispatch("auth/checkToken").catch(() => {
        this.$store.dispatch("auth/refreshToken").catch(() => {
          this.$store.dispatch("auth/resetToken");
        });
      });
    }
  }
};
</script>
